package com.link2room.rodimus.entity;

import com.link2room.common.dto.result.base.UserPassrodEntity;
import com.link2room.common.entity.BaseEntity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by Nakisa on 2016/10/11.
 */
@Entity
@Table(name = "admin_base")
public class AdminBase extends BaseEntity implements UserPassrodEntity {
    private String userName;
    private String password;

    @Basic
    @Column(name = "user_name", nullable = true, length = 32)
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Basic
    @Column(name = "password", nullable = true, length = 32)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AdminBase adminBase = (AdminBase) o;

        if (userName != null ? !userName.equals(adminBase.userName) : adminBase.userName != null) return false;
        if (password != null ? !password.equals(adminBase.password) : adminBase.password != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = userName != null ? userName.hashCode() : 0;
        result = 31 * result + (password != null ? password.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "AdminBase{" +
                "userName='" + userName + '\'' +
                ", password='" + password + '\'' +
                "} " + super.toString();
    }
}
